Skip to content

RewardEmbeddingThroughput metric

Bases: EmbeddingModelRewardsOperationalMetric

Reward-phase embedding calls per second; judge overhead, 0 without EM rewards.

Example:

program.compile(
    metrics=[
        synalinks.metrics.RewardEmbeddingThroughput(),
    ],
)
Source code in synalinks/src/metrics/em_metrics.py
@synalinks_export("synalinks.metrics.RewardEmbeddingThroughput")
class RewardEmbeddingThroughput(EmbeddingModelRewardsOperationalMetric):
    """Reward-phase embedding calls per second; judge overhead, 0 without EM rewards.

    Example:

    ```python
    program.compile(
        metrics=[
            synalinks.metrics.RewardEmbeddingThroughput(),
        ],
    )
    ```
    """

    direction = "up"

    def __init__(self, name="reward_embedding_throughput", description=None):
        super().__init__(name=name, description=description)

    def result(self):
        wall = self._wall_clock_delta()
        if wall <= 0.0:
            return 0.0
        return self._delta("calls") / wall